<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
</head>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.serializeJSON/2.9.0/jquery.serializejson.min.js"></script>
<script>
    function login() {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "jsonp",//预期服务器返回的数据类型
            url: "http://localhost:8080/meal/user/register?callback=?" ,//url
            data: $('#dataform')
            success: function (result) {
                console.log(result);//打印服务端返回的数据(调试用)
                if (result.resultCode == 200) {
                    alert("SUCCESS");
                }
                ;
            },
            error : function() {
                alert("异常！");
            }
        });
    }
</script>
<body>

<form id="dataform" method="post">

    用户名：<input type="text" name="username"><br>
    密码：<input type="password" name="password"><br>
    确认密码：<input type="password"><br>
    性别：<select name="sex">
            <option value="1">男</option>
            <option value="2">女</option>
          </select><br>
    生日：<input type="date" name="birthday"><br>
    邮箱：<input type="email" name="email"><br>
    联系方式：<input type="text" name="phone"><br>
    <input type="button" value="注册" onclick="login()">

</form>

</body>
</html>